<template>
  <a-card :bordered="false">

    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <!--查询条件设置-->
          <a-col :xl="6" :lg="7" :md="8" :sm="24">
            <a-form-item label="参数说明">
              <a-input placeholder="请输入fieldRemark"
                       v-model="queryParam.fieldRemark"></a-input>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button class="ant-btn-custom" @click="searchQuery" icon="search">查询</a-button>
      <a-button class="ant-btn-custom" @click="searchReset" icon="reload">重置</a-button>
      <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
        @change="handleTableChange">
                        <span slot="action" slot-scope="text, record">

                          <a @click="handleEdit(record)">编辑</a>
                          <a-divider type="vertical"/>
                          <a-dropdown>
                            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
                            <a-menu slot="overlay">
                              <a-menu-item>
                                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                                  <a>删除</a>
                                </a-popconfirm>
                              </a-menu-item>
                            </a-menu>
                          </a-dropdown>
                        </span>
      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <TbGenerateItemConfigModal ref="modalForm" @ok="modalFormOk"></TbGenerateItemConfigModal>
  </a-card>
</template>

<script>
import TbGenerateItemConfigModal from './modules/TbGenerateItemConfigModal'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'

export default {
  name: "TbGenerateItemConfigList",
  mixins: [JeecgListMixin],
  components: {
    TbGenerateItemConfigModal
  },
  data() {
    return {
      description: '低代码配置项管理页面',
      // 表头
      columns: [
        {
          title: '#',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          }
        },
        {
          align: 'left',
          sorter: true,
          title: '参数名称',
          dataIndex: 'fieldName',
        },
        {
          align: 'left',
          sorter: true,
          title: '参数说明',
          dataIndex: 'fieldRemark',
        },
        {
          align: 'left',
          sorter: false,
          title: '值类型',
          dataIndex: 'valueType_dictText',
        },
        {
          align: 'left',
          sorter: false,
          title: '是否必填',
          dataIndex: 'required_dictText',
        }, {
          align: 'left',
          sorter: false,
          title: '默认值',
          dataIndex: 'defaultValue',
        },
        {
          align: 'left',
          sorter: false,
          title: '字典类型',
          dataIndex: 'dictType',
        },
        {
          align: 'left',
          sorter: false,
          title: '排序',
          dataIndex: 'sort',
        },
        {
          title: '操作',
          dataIndex: 'action',
          align: "center",
          scopedSlots: {customRender: 'action'},
        }
      ],
      url: {
        list: "/generator/TbGenerateItemConfig/list",
        delete: "/generator/TbGenerateItemConfig/delete",
        excelConfig: "generator/TbGenerateItemConfig/excelConfig"
      },
    }
  },
  created() {
    this.isorter = {
      column: 'id',
      order: 'desc',
    }
  },
  computed: {},
  methods: {}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>
